x<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Models\Business;

class CreateBusinessTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('business', function (Blueprint $table) {

            $table->increments('id')->comment('商户ID');

            $table->string('name', 50)->comment('用户名');

            $table->string('mobile', 20)->comment('手机号');

            $table->string('password', 100)->comment('密码');

            $table->enum('status', [
                Business::STATUS_NORMAL,
                Business::STATUS_DISABLED,
                Business::STATUS_EXPIRED
            ])->comment('状态');

            $table->timestamp('expired_at')->comment('过期时间');

            $table->timestamps();

            $table->rememberToken();

            $table->unique('mobile');

            $table->index('name');

            $table->comment = '商户表';

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('business');
    }
}
